<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%
	String tmp_path = request.getContextPath();
	if("/".equals(tmp_path.trim())) { tmp_path = ""; }
	String sid = StringUtils.trimToEmpty(request.getParameter("sid"));
	if(StringUtils.isNotBlank(sid) && !session.getId().equals(sid)) {
		Cookie cookie = new Cookie("JSESSIONID", sid);
		response.addCookie(cookie);
		response.sendRedirect(tmp_path+"/?JSESSIONID="+sid);
	} else {
		
		response.sendRedirect(tmp_path+"/login.jsp");
	}
%>